<!DOCTYPE html>
<html>
<head>
<title>技师管理</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdn.bootcss.com/admin-lte/2.3.8/css/AdminLTE.min.css">
<link rel="stylesheet" href="https://cdn.bootcss.com/zTree.v3/3.5.26/css/metroStyle/metroStyle.min.css">
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap-table/1.11.1/bootstrap-table.min.css">
<link rel="stylesheet" href="https://cdn.bootcss.com/admin-lte/2.3.8/css/skins/_all-skins.min.css">
<link rel="stylesheet" href="https://cdn.bootcss.com/admin-lte/2.3.8/css/AdminLTE.min.css">
<link rel="stylesheet" href="/plugins/jqfileupload/css/jquery.fileupload.css">
<link rel="stylesheet" href="/css/main.css">

</head>
<body class="hold-transition skin-blue sidebar-mini">
<div id="app" v-cloak class="wrapper">
  <main-header></main-header>
  <main-sidebar></main-sidebar>
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <content-header title="技师管理"></content-header>
    <!-- Main content -->
    <section class="content">
	<div v-show="showList">
		<div class="box">
			<div class="box-header with-border">
              <h3 class="box-title">列表</h3>
            </div><!-- /.box-header -->
            <div class="box-body">
				<div class="form-group">
					<a class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
					<a class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
					<a class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
				</div>
			    <table id="table"></table>
			</div>
		</div>	
    </div>
    
    <div v-show="!showList">
		<div class="box">
			<div class="box-header with-border">
              <h3 class="box-title">{{title}}</h3>
            </div><!-- /.box-header -->
            <div class="box-body">
		<form class="form-horizontal">
		<div class="form-group">
				   	<div class="col-sm-2 control-label">头像</div>
				   	<div class="col-sm-7">
				        <!-- The fileinput-button span is used to style the file input field as button -->
					    <span class="btn btn-success fileinput-button">
					        <i class="glyphicon glyphicon-plus"></i>
					        <span>选择头像...</span>
					        <!-- The file input field used as target for the file upload widget -->
					        <input id="fileupload" type="file" name="file" multiple>
					    </span>
					    <br>
					    <br>
					    <!-- The container for the uploaded files -->
					    <div id="files" class="files">
					    	<div>
					    		<img alt="" width="200px" :src="teacher.picUrl">
					    	</div>
					    </div>
				    </div>
				</div>
			<div class="form-group">
			   	<div class="col-sm-2 control-label">技师名称</div>
			   	<div class="col-sm-7">
			      <input type="text" class="form-control" v-model="teacher.realName" placeholder="技师名称"/>
			    </div>
			</div>
			<div class="form-group">
			   	<div class="col-sm-2 control-label">电话</div>
			   	<div class="col-sm-7">
			      <input type="text" class="form-control" v-model="teacher.mobile" placeholder="电话"/>
			    </div>
			</div>
			<div class="form-group">
			   	<div class="col-sm-2 control-label">特长</div>
			   	<div class="col-sm-7">
			      <textarea rows="" cols="" class="form-control" v-model="teacher.specialty" placeholder="特长"></textarea>
			    </div>
			</div>
									<div class="form-group">
			   	<div class="col-sm-2 control-label">简介</div>
			   	<div class="col-sm-7">
			      <textarea rows="" cols="" class="form-control" v-model="teacher.remark" placeholder="简介" ></textarea>
			    </div>
			</div>
							<div class="form-group">
				<div class="col-sm-2 control-label"></div> 
				<input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
				&nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
			</div>
		</form>
		</div>
	</div>
	</div>
	</section>
  </div>
</div>
<script src="https://cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/layer/2.3/layer.js"></script>
<script src="https://cdn.bootcss.com/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/vue/2.2.6/vue.min.js"></script>
<script src="https://cdn.bootcss.com/bootstrap-table/1.11.1/bootstrap-table.min.js"></script>
<script src="https://cdn.bootcss.com/bootstrap-table/1.11.1/locale/bootstrap-table-zh-CN.min.js"></script>

<script src="/plugins/jqfileupload/js/vendor/jquery.ui.widget.js"></script>
<script src="/plugins/jqfileupload/js/jquery.fileupload.js"></script>
<script src="/js/admin/common.js"></script>
<script src="/js/admin/components.js"></script>
<script src="/js/app.js"></script>
<script src="/js/admin/home/teacher.js"></script>
<script type="text/javascript">
$(function(){
	// Change this to the location of your server-side upload handler:
    var url = "/api/fileupload/upload";
    $('#fileupload').fileupload({
        url: url,
        dataType: 'json',
        done: function (e, data) {
            if(data.result.code == 0){
            	console.log(data.result);
            	vm.teacher.picUrl = data.result.url;
            }
        }
    }).prop('disabled', !$.support.fileInput)
        .parent().addClass($.support.fileInput ? undefined : 'disabled');
})
</script>
</body>
</html>